﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Efcore.MultiTenant.CacheKey
{
    public sealed class TenantModelCacheKeyFactory<TDbContext> : ModelCacheKeyFactory
        where TDbContext : DbContext
    {

        public override object Create(DbContext context)
        {
            return new TenantModelCacheKey<TDbContext>(context as TDbContext, (context as BaseDbContext).TenantInfo.TenantId);
        }

        public TenantModelCacheKeyFactory(ModelCacheKeyFactoryDependencies dependencies) : base(dependencies)
        {
        }
    }
}